<template>
  <div
    class="
      w-8/12
      bg-white
      mt-8
      rounded-lg
      flex flex-initial flex-col
      items-center
      space-y-8
    "
  >
  <div class="flex w-full" v-for="(item,index) in articleList" :key="index">
<article-child :articleinfo="item"></article-child>
  </div>
  <!--  -->
    <el-pagination background layout="prev, pager, next" :total="$store.state.allDqarticleNum">
    </el-pagination>
  </div>
</template>
<script>
// import axios from "axios";
import ArticleChild from "./ArticleChild.vue";
import { requests } from "../network/request";
export default {
  name: "Article",
  data() {
    return {
      articleList: {}
    }
  },
  components: {
    ArticleChild,
  },
  mounted() {
    //分页查询所有的文章
    requests({
      url: 'dqarticle/superlist',
      method: 'get'
    }).then(res => {
      console.log(res);
      if(res.data.code == 200){
        //查询成功
        this.articleList = res.data.data.list
        //写入文章总数
        this.$store.commit("updateAllDqarticleNum", res.data.data.total);
      }else if(res.data.code == 404){
        //没有查询到
      }
    }).catch(err => {
      console.log(err);
    })


  },
};
</script>
<style scoped>
</style>